python np get indices where value

42

x = numpy.array([1,0,2,0,3,0,4,5,6,7,8])
numpy.where(x == VALUE)[0]
# e.g. for VALUE = 0, it prints:
array([1, 3, 5])

Comments

Submit
0 Comments